package com.study.phoenix.mapper;

import com.study.phoenix.entity.Order;
import org.apache.ibatis.annotations.*;

import java.math.BigDecimal;
import java.util.List;

public interface OrderMapper {
    @Results(value = {
            @Result(property = "id", column = "id", id = true),
            @Result(property = "orderCode", column = "order_code"),
            @Result(property = "totalAmount", column = "total_amount"),
            @Result(property = "createTime", column = "create_time"),
            @Result(property = "userId", column = "user_id")
    })
    @Select("SELECT * FROM tbl_order")
    List<Order> getOrders();

    @Insert("UPSERT INTO tbl_order(id,total_amount) VALUES (#{id},#{totalAmount})")
    void updateOrder(@Param("id") Long id, @Param("totalAmount") BigDecimal totalAmount);
}
